﻿using System;
using System.Text.RegularExpressions;

namespace PackageLinSample.MaskEngine
{
    public class MaskEngine
    {
        public string Mask(string name, string value) {
            if (value == null) return null;

            if (string.IsNullOrEmpty(value)) return value;

            if ("firstname".Equals(name, StringComparison.OrdinalIgnoreCase))
            {
                return "fi****me";
            }

            else if ("password".Equals(name, StringComparison.OrdinalIgnoreCase))
            {
                return Regex.Replace(value, "\\w", "*");
            }
            else
                return value;
        }
    }
}
